package com.tttshaoqi.server.config;

import com.tttshaoqi.server.security.JwtUtil;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "app.jwt")
public class JwtConfig {

    private String secret = "ChangeThisSecretToAStrongKey_AtLeast_32_Bytes_123456";
    private long ttlSeconds = 3600;

    @Bean
    public JwtUtil jwtUtil() {
        return new JwtUtil(secret, ttlSeconds);
    }

    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    public long getTtlSeconds() {
        return ttlSeconds;
    }

    public void setTtlSeconds(long ttlSeconds) {
        this.ttlSeconds = ttlSeconds;
    }
}


